import person from './modules/person'

const getters = {
  sidebar: state => state.app.sidebar,
  device: state => state.app.device,
  token: state => state.user.token,
  manageShop: state => state.user.manageShop,
  avatar: state => state.user.avatar,
  name: state => state.user.name,
  permission_routers: state => state.permission.routers,
  addRouters: state => state.permission.addRouters,
  roles: state => state.user.roles,
  rolesName: state => state.user.rolesName,
  cartList: state => state.person.cart,
  cityId: state => state.person.city.cityId,
  shopId: state => state.person.selectShop.shopId,
  findProduct: state => (id) => {
    for (let i = 0; i < state.person.cart.length; i++) {
      if (state.person.cart[i].product.pid === id) {
        return i
      }
    }
    return -1
  },
  language: state => 'zh'
}
export default getters
